
import 'dart:ffi';

import 'package:framelib/base/base_service.dart';
import 'package:framelib/net/baseentity.dart';
import 'package:module_business/module_comm/model/comm_entity_factory.dart';
import 'package:module_business/module_comm/model/country_entity.dart';
import 'package:module_business/module_index/model/index_room_item_entity.dart';
import 'package:module_business/module_index/model/voice_chat_tag_entity.dart';
import 'package:module_business/module_index/model/voice_person_entity.dart';

import '../../module_comm/model/user_entity.dart';
import '../model/index_entity_factory.dart';
import 'net/index_api.dart';
import 'net/index_net_utils.dart';

/**
 * ModuleIndex 网络层
 */
class ModuleIndexService with BaseService{

  // 标签列表接口
  Future<BaseEntity> api_voicechat_tag_list() async {
    return await IndexNetUtils.instance.postData<VoiceChatTagEntity,IndexEntityFactory>
      (IndexEntityFactory.instance,IndexApi.instance.api_voicechat_tag_list ,
      queryParameters: {},isList: true,
    );
  }
  // 根据标签Id查询房间列表(传标签ID)
  Future<BaseEntity> api_voicechat_room_findRoomListByTag({Map<String, dynamic> parmsMap}) async {
    return await IndexNetUtils.instance.postData<IndexRoomItemEntity,IndexEntityFactory>
      (IndexEntityFactory.instance,IndexApi.instance.api_voicechat_room_findRoomListByTag ,
      params: parmsMap,isList: true,
    );
  }
  // 查询房间管理员(传房间ID)
  Future<BaseEntity> api_voicechat_room_queryRoomAdminUser({Map<String, dynamic> parmsMap}) async {
    return await IndexNetUtils.instance.postData<VoicePersonEntity,IndexEntityFactory>
      (IndexEntityFactory.instance,IndexApi.instance.api_voicechat_room_queryRoomAdminUser ,
      params: parmsMap,isList: true,
    );
  }
  // 创建房间
  Future<BaseEntity> api_voicechat_room_createRoom({Map<String, dynamic> parmsMap}) async {
    return await IndexNetUtils.instance.postData<IndexRoomItemEntity,IndexEntityFactory>
      (IndexEntityFactory.instance,IndexApi.instance.api_voicechat_room_createRoom ,
      params: parmsMap,isList: false,
    );
  }
  // 创建房间
  Future<BaseEntity> api_voicechat_room_updateChatRoom({Map<String, dynamic> parmsMap}) async {
    return await IndexNetUtils.instance.postData<IndexRoomItemEntity,IndexEntityFactory>
      (IndexEntityFactory.instance,IndexApi.instance.api_voicechat_room_updateChatRoom ,
      params: parmsMap,isList: false,
    );
  }
  // 查询我的房间
  Future<BaseEntity> api_voicechat_room_queryMyRoom({Map<String, dynamic> parmsMap}) async {
    return await IndexNetUtils.instance.postData<IndexRoomItemEntity,IndexEntityFactory>
      (IndexEntityFactory.instance,IndexApi.instance.api_voicechat_room_queryMyRoom ,
      params: parmsMap,isList: false,
    );
  }
  // 查询房间
  Future<BaseEntity> api_voicechat_room_queryRoomByCode({Map<String, dynamic> parmsMap}) async {
    return await IndexNetUtils.instance.postData<IndexRoomItemEntity,IndexEntityFactory>
      (IndexEntityFactory.instance,IndexApi.instance.api_voicechat_room_queryRoomByCode ,
      params: parmsMap,isList: false,
    );
  }

  // 进入房间
  Future<BaseEntity> api_voicechat_room_joinRoom({Map<String, dynamic> parmsMap}) async {
    return await IndexNetUtils.instance.postData<IndexRoomItemEntity,IndexEntityFactory>
      (IndexEntityFactory.instance,IndexApi.instance.api_voicechat_room_joinRoom ,
      params: parmsMap,isList: false,
    );
  }
  //进入房间成功
  Future<BaseEntity> api_voicechat_room_joinRoomSuccess({Map<String, dynamic> parmsMap}) async {
    return await IndexNetUtils.instance.postData<IndexRoomItemEntity,IndexEntityFactory>
      (IndexEntityFactory.instance,IndexApi.instance.api_voicechat_room_joinRoomSuccess ,
      params: parmsMap,isList: false,
    );
  }
  //绑定和解绑用户房间关系(拉黑设置管理员)
  Future<BaseEntity> api_voicechat_room_bindOrUnBindUserRoomRelation({Map<String, dynamic> parmsMap,bool isBind}) async {
    return await IndexNetUtils.instance.postData<VoicePersonEntity,IndexEntityFactory>
      (IndexEntityFactory.instance,
      (isBind??false)?
      IndexApi.instance.api_voicechat_room_bindUserRoomRelation
          :IndexApi.instance.api_voicechat_room_unbindUserRoomRelation,
      params: parmsMap,isList: false,
    );
  }
  //查询用户房间关系
  Future<BaseEntity> api_voicechat_room_queryUserRoomRelationType({Map<String, dynamic> parmsMap}) async {
    return await IndexNetUtils.instance.postData<VoicePersonEntity,IndexEntityFactory>
      (IndexEntityFactory.instance,
      IndexApi.instance.api_voicechat_room_queryUserRoomRelationType,
      params: parmsMap,isList: false,
    );
  }
  // 查询房间黑名单(传房间ID)
  Future<BaseEntity> api_voicechat_room_queryRoomBlackUser({Map<String, dynamic> parmsMap}) async {
    return await IndexNetUtils.instance.postData<VoicePersonEntity,IndexEntityFactory>
      (IndexEntityFactory.instance,IndexApi.instance.api_voicechat_room_queryRoomBlackUser ,
      params: parmsMap,isList: true,
    );
  }
  // 查询房间禁言名单(传房间ID)
  Future<BaseEntity> api_voicechat_room_queryRoomGagUser({Map<String, dynamic> parmsMap}) async {
    return await IndexNetUtils.instance.postData<VoicePersonEntity,IndexEntityFactory>
      (IndexEntityFactory.instance,IndexApi.instance.api_voicechat_room_queryRoomGagUser ,
      params: parmsMap,isList: true,
    );
  }
  // 根据云信ID查询用户信息
  Future<BaseEntity> api_voicechat_room_queryOnlineUserInfo({Map<String, dynamic> parmsMap}) async {
    return await IndexNetUtils.instance.postData<UserEntity,IndexEntityFactory>
      (IndexEntityFactory.instance,IndexApi.instance.api_voicechat_room_queryOnlineUserInfo ,
      params: parmsMap,isList: true,
    );
  }
  // 锁定麦位
  Future<BaseEntity> api_voicechat_room_lockMike({Map<String, dynamic> parmsMap}) async {
    return await IndexNetUtils.instance.postData<UserEntity,IndexEntityFactory>
      (IndexEntityFactory.instance,IndexApi.instance.api_voicechat_room_lockMike ,
      params: parmsMap,isList: false,
    );
  }
  // 解锁麦位
  Future<BaseEntity> api_voicechat_room_unlockMike({Map<String, dynamic> parmsMap}) async {
    return await IndexNetUtils.instance.postData<String,IndexEntityFactory>
      (IndexEntityFactory.instance,IndexApi.instance.api_voicechat_room_unlockMike ,
      params: parmsMap,isList: false,
    );
  }
  // 用户申请上麦
  Future<BaseEntity> api_voicechat_room_onMike({Map<String, dynamic> parmsMap}) async {
    return await IndexNetUtils.instance.postData<String,IndexEntityFactory>
      (IndexEntityFactory.instance,IndexApi.instance.api_voicechat_room_onMike ,
      params: parmsMap,isList: false,
    );
  }
  // 下麦
  Future<BaseEntity> api_voicechat_room_downMike({Map<String, dynamic> parmsMap}) async {
    return await IndexNetUtils.instance.postData<String,IndexEntityFactory>
      (IndexEntityFactory.instance,IndexApi.instance.api_voicechat_room_downMike ,
      params: parmsMap,isList: false,
    );
  }

  //分页查询用户收藏的房间
  Future<BaseEntity> api_voicechat_room_queryCollectionRoomList({Map<String, dynamic> parmsMap}) async {
    return await IndexNetUtils.instance.postData<IndexRoomItemEntity,IndexEntityFactory>
      (IndexEntityFactory.instance,IndexApi.instance.api_voicechat_room_queryCollectionRoomList ,
      params: parmsMap,isList: true,
    );
  }
  //查询用户浏览的房间
  Future<BaseEntity> api_voicechat_room_queryLatestRoom({Map<String, dynamic> parmsMap}) async {
    return await IndexNetUtils.instance.postData<IndexRoomItemEntity,IndexEntityFactory>
      (IndexEntityFactory.instance,IndexApi.instance.api_voicechat_room_queryLatestRoom ,
      params: parmsMap,isList: true,
    );
  }
  // 收藏或取消收藏房间
  Future<BaseEntity> api_voicechat_room_collectionOrUnRoom({Map<String, dynamic> parmsMap,bool isCollection}) async {
    return await IndexNetUtils.instance.postData<BaseEntity,IndexEntityFactory>
      (IndexEntityFactory.instance,
      (isCollection??false)?IndexApi.instance.api_voicechat_room_collectionRoom
          :IndexApi.instance.api_voicechat_room_uncollectRoom ,
      params: parmsMap,isList: false,
    );
  }
  // 查询用户是否收藏了房间
  Future<BaseEntity> api_voicechat_room_queryUserCollectionRoomState({Map<String, dynamic> parmsMap}) async {
    return await IndexNetUtils.instance.postData<bool,IndexEntityFactory>
      (IndexEntityFactory.instance, IndexApi.instance.api_voicechat_room_queryUserCollectionRoomState ,
      params: parmsMap,isList: false,
    );
  }

  // 举报
  Future<BaseEntity> api_feedback_feedbackVideo({Map<String, dynamic> parmsMap}) async {
    return await IndexNetUtils.instance.postData<String,IndexEntityFactory>
      (IndexEntityFactory.instance,IndexApi.instance.api_feedback_feedbackVideo ,
      params: parmsMap,isList: false,
    );
  }
}
